define(function (require, exports, module) {

    var $ = require("zepto");
    var global = require("global");
    var page = require("page");
    var media = require("media");

    require("touch");
    require("image");
    require("event");
    require("plugins");

    module.exports = {
        init_modle: function () {

            global._scrollStop();

            document.body.style.userSelect = "none";
            document.body.style.mozUserSelect = "none";
            document.body.style.webkitUserSelect = "none";

            global._IsPC() ? $(document.body).addClass("pc") : $(document.body).addClass("mobile");
            global._Android && $(document.body).addClass("android");
            global._iPhoen && $(document.body).addClass("iphone");
            global._hasPerspective() ? (global._rotateNode.addClass("transformNode-3d"), $(document.body).addClass("perspective"), $(document.body).addClass("yes-3d")) : (global._rotateNode.addClass("transformNode-2d"), $(document.body).addClass("no-3d"));
            $(".translate-back").addClass("z-pos"), $('input[type="hidden"]').appendTo($("body")), setTimeout(function () {
                $(".m-alert").find("strong").addClass("z-show");
            }, 1e3);
            var loading_time = (new Date).getTime();
            $(window).on("load", function () {
                var now = (new Date).getTime();
                var loading_end = false;
                var time;
                var time_del = now - loading_time;
                time_del >= 2200 && (loading_end = !0);
                time = loading_end ? 0 : 2200 - time_del;
                setTimeout(function () {
                    setTimeout(function () {
                        $(".m-alert").addClass("f-hide");
                    }, 4e3);
                    var mengban = $(".translate-front").data("open");
                    if (1 === mengban) {
                        $(".translate-front").removeClass("f-hide");
                        setTimeout(function () {
                            $(".translate-front").addClass("z-show");
                            $(".m-fengye").removeClass("f-hide");
                            page._page.eq(page._pageNow).height($(window).height());
                            setTimeout(function () {
                                $(".translate-back").removeClass("f-hide");
                            }, 900);
                        }, 30);
                    } else {
                        $(".m-fengye").removeClass("f-hide");
                        page._page.eq(page._pageNow).height($(window).height());
                        setTimeout(function () {
                            $(".translate-back").removeClass("f-hide");
                            $(".u-arrow").removeClass("f-hide");
                            media._audio && (media._audioNode.removeClass("f-hide"), media._audio.play())
                        }, 90)
                    }
                }, time);
            });
            var channel_id = location.search.substr(location.search.indexOf("channel=") + 8);
            channel_id = channel_id.match(/^\d+/), (!channel_id || isNaN(channel_id) || 0 > channel_id) && (channel_id = 1);
            var activity_id = $("#activity_id").val();
            var url = "/auto/analyse/" + activity_id + "?channel=" + channel_id;
//            $.get(url, {}, function () {
//                if (4308 == activity_id) {
//                    var script = document.createElement("script");
//                    script.type = "text/javascript";
//                    script.src = ("https:" == document.location.protocol ? "https://" : "http://") + "hm.baidu.com/h.js?883e5df898da36becbc7278612991839";
//                    var e = document.getElementsByTagName("script")[0];
//                    e.parentNode.insertBefore(script, e);
//                }
//            });
            $(".p-ct").height($(window).height());
            $(".m-page").height($(window).height());
            $("#j-mengban").height($(window).height());
            $(".translate-back").height($(window).height());
        }};
});

seajs.use('app', function (app) {
    app.init_modle();
});